[[package]]
name = "anstream"
-version = "0.6.21"
+version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a"
+checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d"
dependencies = [
"anstyle",
"anstyle-parse",
[[package]]
name = "anstyle"
-version = "1.0.13"
+version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78"
+checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
[[package]]
name = "anstyle-parse"
-version = "0.2.7"
+version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2"
+checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e"
dependencies = [
"utf8parse",
]
[[package]]
name = "clap"
-version = "4.5.60"
+version = "4.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2797f34da339ce31042b27d23607e051786132987f595b02ba4f6a6dffb7030a"
+checksum = "b193af5b67834b676abd72466a96c1024e6a6ad978a1f484bd90b85c94041351"
dependencies = [
"clap_builder",
"clap_derive",
[[package]]
name = "clap_builder"
-version = "4.5.60"
+version = "4.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "24a241312cea5059b13574bb9b3861cabf758b879c15190b37b6d6fd63ab6876"
+checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f"
dependencies = [
"anstream",
"anstyle",
[[package]]
name = "clap_derive"
-version = "4.5.55"
+version = "4.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5"
+checksum = "1110bd8a634a1ab8cb04345d8d878267d57c3cf1b38d91b71af6686408bbca6a"
dependencies = [
"heck",
"proc-macro2",
[[package]]
name = "clap_lex"
-version = "1.0.0"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831"
+checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9"
[[package]]
name = "colorchoice"
-version = "1.0.4"
+version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
+checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570"
[[package]]
name = "equivalent"
[[package]]
name = "itoa"
-version = "1.0.17"
+version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"
+checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
[[package]]
name = "js-sys"
[[package]]
name = "libc"
-version = "0.2.182"
+version = "0.2.183"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112"
+checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d"
[[package]]
name = "libtest-mimic"
-version = "0.8.1"
+version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5297962ef19edda4ce33aaa484386e0a5b3d7f2f4e037cbeee00503ef6b29d33"
+checksum = "14e6ba06f0ade6e504aff834d7c34298e5155c6baca353cc6a4aaff2f9fd7f33"
dependencies = [
"anstream",
"anstyle",
[[package]]
name = "once_cell"
-version = "1.21.3"
+version = "1.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
+checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
[[package]]
name = "once_cell_polyfill"
"linkme",
"paste",
"quick-junit",
- "rustix",
"tempfile",
"xshell",
]
[[package]]
name = "tempfile"
-version = "3.26.0"
+version = "3.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "82a72c767771b47409d2345987fda8628641887d5466101319899796367354a0"
+checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
dependencies = [
"fastrand",
"getrandom",
//!
//! Tests are split into two categories:
//!
-//! * **Booted** (`booted_test!`) — need a fully deployed ostree system
-//! (composefs, sysroot, boot markers). When not root these dispatch via
-//! `bcvk libvirt run` which does a full `bootc install to-disk`.
+//! * **Booted** — need a fully deployed ostree system
+//! (composefs, sysroot, boot markers).
//!
-//! * **Privileged** (`privileged_test!`) — just need root and the ostree
-//! binary installed. When not root these dispatch via the much faster
-//! `bcvk ephemeral run-ssh` (no disk install).
+//! * **Privileged** — just need root and the ostree binary installed.
+//!
+//! VM deployment is handled externally by `just test-tmt` (bcvk + tmt)
+//! or `just integration-container` (bcvk direct). These tests always
+//! run as root inside the VM.
use anyhow::{ensure, Result};
use xshell::{cmd, Shell};
use crate::integration_test;
-/// How a test should be dispatched when not running as root.
-/// See the module-level docs for details on each mode.
-enum RunMode {
- Booted,
- Privileged,
-}
-
macro_rules! booted_test {
($fn_name:ident, $body:expr) => {
fn $fn_name() -> Result<()> {
- if require_root(stringify!($fn_name), RunMode::Booted)?.is_some() {
- return Ok(());
- }
$body
}
integration_test!($fn_name);
macro_rules! privileged_test {
($fn_name:ident, $body:expr) => {
fn $fn_name() -> Result<()> {
- if require_root(stringify!($fn_name), RunMode::Privileged)?.is_some() {
- return Ok(());
- }
$body
}
integration_test!($fn_name);
};
}
-/// Returns `Ok(None)` if already root (test proceeds normally).
-/// Otherwise dispatches to a VM per `mode` and returns `Ok(Some(()))`.
-fn require_root(test_name: &str, mode: RunMode) -> Result<Option<()>> {
- if rustix::process::getuid().is_root() {
- return Ok(None);
- }
-
- // We're on the host without root — delegate to a VM.
- if std::env::var_os("OSTREE_IN_VM").is_some() {
- anyhow::bail!("OSTREE_IN_VM is set but we're not root — VM setup is broken");
- }
-
- let image = std::env::var("OSTREE_TEST_IMAGE").map_err(|_| {
- anyhow::anyhow!(
- "not root and OSTREE_TEST_IMAGE not set; \
- run `just integration-container` to build and test"
- )
- })?;
-
- let sh = Shell::new()?;
- let bcvk = std::env::var("BCVK_PATH").unwrap_or_else(|_| "bcvk".into());
-
- match mode {
- RunMode::Booted => {
- // Use a unique VM name per test to avoid collisions
- let vm_name = format!("ostree-test-{}", test_name.replace('_', "-"));
-
- // Deploy a full VM (bootc install to-disk + boot) and wait for SSH
- cmd!(
- sh,
- "{bcvk} libvirt run --name {vm_name} --replace --detach --ssh-wait {image}"
- )
- .run()?;
-
- // Run the test inside the deployed VM
- let result = cmd!(
- sh,
- "{bcvk} libvirt ssh {vm_name} -- ostree-bootc-integration-tests --exact {test_name}"
- )
- .run();
-
- // Always clean up the VM
- let _ = cmd!(sh, "{bcvk} libvirt rm --stop --force {vm_name}").run();
-
- // Propagate the test result
- result?;
- }
- RunMode::Privileged => {
- // Fast path: ephemeral container, no disk install needed
- cmd!(
- sh,
- "{bcvk} ephemeral run-ssh {image} -- ostree-bootc-integration-tests --exact {test_name}"
- )
- .run()?;
- }
- }
-
- Ok(Some(()))
-}
-
booted_test!(privileged_verify_ostree_booted, {
let sh = Shell::new()?;